#include <iostream>
#include <string>

/**
1. 提供一个抽象组件类: 抽象被装饰者的行为
2. 提供一个或多个具体组件类: 被装饰者的行为具体实现
3. 提供一个抽象装饰器类: 抽象组件指针与抽象组件一致接口
4. 提供一个具体的装饰器类: 为具体组件附加责任
 */
class AbstractComponent {
public:
    virtual void show() = 0;
    std::string pStr;
};

class Girl : public AbstractComponent {
public:
    Girl() {
        pStr = "啥也没穿的女孩子";
    }
    virtual void show() {
        std::cout << pStr << std::endl;
    }
};

class AbstractDecorator : public AbstractComponent {
public:
    virtual void show() = 0;

protected:
    AbstractComponent* pBase;
};

//超短裙
class MiniSkirt : public AbstractDecorator {
public:
    MiniSkirt(AbstractComponent* base) {
        pBase = base;
    }
    void show() {
        this->pStr = this->pBase->pStr + "  穿超短裙";
        std::cout << this->pStr << std::endl;

    }
};

//黑丝
class BlackSilk : public AbstractDecorator {
public:
    BlackSilk(AbstractComponent* base) {
        pBase = base;
    }
    void show() {
        this->pStr = this->pBase->pStr + "  穿黑丝";
        std::cout << pStr << std::endl;

    }
};

int main(int argc, char const* argv[]) {
    Girl* girl = new Girl();
    girl->show();
    MiniSkirt* skirt = new MiniSkirt(girl);
    skirt->show();
    BlackSilk* blackSilk = new BlackSilk(girl);
    blackSilk->show();
    return 0;
}